package com.cdwang.websocketmodule.app;

import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;

/**
 * copyright (C), 2022, 运达科技有限公司
 * fileName App
 *
 * @author 王玺权
 * date 2022-10-24 15:45
 * description
 * history
 */
public class App extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        String   url="ws://139.9.246.226:8194/DTCG/sendPromptMsgWebSocket.ws?userid=SZ001&dataType=appConnect&cdid=";
        saveWebSocketUrl(url);
    }

    private void saveWebSocketUrl(String url){
            SharedPreferences settings = getSharedPreferences("WebSocketUrl", Context.MODE_PRIVATE);
        //生成一个保存编辑对象
        SharedPreferences.Editor editor = settings.edit();
        editor.putString("WebSocketUrl",url);
        //移除所有键值对
        editor.clear();
        editor.commit();
    }
}
